<?php require RCMS_Object_QuickConfig_QuickConfig::PATH_HEADER; ?>
<?php echo $this->headLink()->appendStylesheet($this->websiteUrl . 'system/css/seotoaster.css'); ?>
<?php echo $this->headScript()->appendFile($this->websiteUrl . 'system/js/jquery/jquery.js'); ?>
<script type="text/javascript">
function loadImages(folder)
{
    $.ajax({
        type : 'POST',
        url : '<?php echo $this->websiteUrl; ?>sys/backend_shopping/loadimages/',
        data : {folder : folder},
        success : function(data) {
            var obj = eval('('+data+')');
            $('#list_images').html(obj.small.replace(/shop\./g, ''));
            $('#list_images').show('700');
        }
    });
}
function selectImage(path)
{
    src = path.replace('<?php echo $this->websiteUrl; ?>', '');
    $('#company-logo').val(src);
    $('.logo').attr('src', path);
    $('#list_images').hide('700');
}

$(document).ready(function(){
    <?php echo ($this->shoppingConfig['quote']!='1'? "$('#gen-quote-auto').hide()" : " ") ;?>

    $('#quote').change(function(){
        if ($(this).attr('checked')) $('#gen-quote-auto').slideDown()
        else $('#gen-quote-auto').slideUp()
    })
});
</script>
<div id="seotoaster" class="shoppingconfig">
<div class="admineditwhat">{%Shopping Config%} </div>
<div class="close_window" onclick="parent.tb_remove();"></div>
<?php if ($this->error) : ?>
<div id="message" class="errors" style="background-color:red;" onclick="this.style.display='none';">{%Corrupted data detected. Configuration not updated%}.</div>
<?php endif; ?>
<?php if ($this->update) : ?>
<div id="message" class="errors" style="background-color:green;" onclick="this.style.display='none';">{%Configuration updated%}.</div>
<?php endif; ?>
<div id="list_images"></div>
<form action="<?php echo $this->websiteUrl; ?>sys/backend_shopping/config/" name="saveconfig" id="saveconfig" method="post" enctype="multipart/form-data">
    <div class="block1">
      <fieldset style="background-color:#fff; text-align:center;"><legend>{%Company Logo%}</legend>
	   <div id="company_logo" style="overflow: visible;">
			<select id="image_folders" style="width:150px;" onchange="loadImages(this.options[this.selectedIndex].value);">
                <option value="" selected="selected">select folder</option>
                <?php if(!empty($this->listFolders) && is_array($this->listFolders)): ?>
                    <?php foreach($this->listFolders as $folderName): ?>
                     <option value="<?php echo trim($folderName); ?>"><?php echo $folderName; ?></option>
                    <?php endforeach; ?>
                <?php endif; ?>
            </select>
			<input type="hidden" name="company-logo" id="company-logo"  value="<?php echo $this->shoppingConfig['company_logo']; ?>" />      
		   <div style="clear:both;"></div>
		    <img src="<?php echo $this->logoCompany !='' ? $this->logoCompany : $this->websiteUrl.'system/images/noimage.png'; ?>" alt="<?php echo $this->logoCompany; ?>" class="logo" border="0"> 
		</div>
		</fieldset>
			
	    <fieldset><legend>{%Business Information%}</legend>
		<p><label>{%Company%}:</label><input type="text" value="<?php echo $this->shoppingConfig['company']; ?>" name="company" id="company" /></p>
        <p><label>{%Phone%}:</label><input type="text" value="<?php echo $this->shoppingConfig['phone']; ?>" name="phone" id="phone" /></p>
        <p><label>{%Email%}:</label><input type="text" value="<?php echo $this->shoppingConfig['email']; ?>" name="email" id="email" /></p>
        <p><label>{%Address1%}:</label><input type="text" value="<?php echo $this->shoppingConfig['address']; ?>" name="address" id="address" /></p>
        <p><label>{%Address2%}:</label><input type="text" value="<?php echo $this->shoppingConfig['address2']; ?>" name="address2" id="address2" /></p>
        <div style="overflow:hidden;padding:2px;">
            <label style="margin:0px 5px 0px 0px;">{%City:%}</label> <input type="text" value="<?php echo $this->shoppingConfig['city']; ?>" name="city" id="city" style="height:23px;width:140px;padding:2px 3px"/>
            <label style="margin:0px 5px 0px 10px;">{%State:%}</label>
		<select id="state" name="state" style="color:#7c7c7c;margin-left:3px;width:70px;">
                    <option value=""<?php echo ($this->shoppingConfig['state']==''?' selected="selected"':''); ?>>{%State%}</option>
                    <option value="AK"<?php echo ($this->shoppingConfig['state']=='AK'?' selected="selected"':''); ?>>AK</option>
                    <option value="AL"<?php echo ($this->shoppingConfig['state']=='AL'?' selected="selected"':''); ?>>AL</option>
                    <option value="AR"<?php echo ($this->shoppingConfig['state']=='AR'?' selected="selected"':''); ?>>AR</option>
                    <option value="AZ"<?php echo ($this->shoppingConfig['state']=='AZ'?' selected="selected"':''); ?>>AZ</option>
                    <option value="CA"<?php echo ($this->shoppingConfig['state']=='CA'?' selected="selected"':''); ?>>CA</option>
                    <option value="CO"<?php echo ($this->shoppingConfig['state']=='CO'?' selected="selected"':''); ?>>CO</option>
                    <option value="CT"<?php echo ($this->shoppingConfig['state']=='CT'?' selected="selected"':''); ?>>CT</option>
                    <option value="DC"<?php echo ($this->shoppingConfig['state']=='DC'?' selected="selected"':''); ?>>DC</option>
                    <option value="DE"<?php echo ($this->shoppingConfig['state']=='DE'?' selected="selected"':''); ?>>DE</option>
                    <option value="FL"<?php echo ($this->shoppingConfig['state']=='FL'?' selected="selected"':''); ?>>FL</option>
                    <option value="GA"<?php echo ($this->shoppingConfig['state']=='GA'?' selected="selected"':''); ?>>GA</option>
                    <option value="HI"<?php echo ($this->shoppingConfig['state']=='HI'?' selected="selected"':''); ?>>HI</option>
                    <option value="IA"<?php echo ($this->shoppingConfig['state']=='IA'?' selected="selected"':''); ?>>IA</option>
                    <option value="ID"<?php echo ($this->shoppingConfig['state']=='ID'?' selected="selected"':''); ?>>ID</option>
                    <option value="IL"<?php echo ($this->shoppingConfig['state']=='IL'?' selected="selected"':''); ?>>IL</option>
                    <option value="IN"<?php echo ($this->shoppingConfig['state']=='IN'?' selected="selected"':''); ?>>IN</option>
                    <option value="KS"<?php echo ($this->shoppingConfig['state']=='KS'?' selected="selected"':''); ?>>KS</option>
                    <option value="KY"<?php echo ($this->shoppingConfig['state']=='KY'?' selected="selected"':''); ?>>KY</option>
                    <option value="LA"<?php echo ($this->shoppingConfig['state']=='LA'?' selected="selected"':''); ?>>LA</option>
                    <option value="MA"<?php echo ($this->shoppingConfig['state']=='MA'?' selected="selected"':''); ?>>MA</option>
                    <option value="MD"<?php echo ($this->shoppingConfig['state']=='MD'?' selected="selected"':''); ?>>MD</option>
                    <option value="ME"<?php echo ($this->shoppingConfig['state']=='ME'?' selected="selected"':''); ?>>ME</option>
                    <option value="MI"<?php echo ($this->shoppingConfig['state']=='MI'?' selected="selected"':''); ?>>MI</option>
                    <option value="MN"<?php echo ($this->shoppingConfig['state']=='MN'?' selected="selected"':''); ?>>MN</option>
                    <option value="MO"<?php echo ($this->shoppingConfig['state']=='MO'?' selected="selected"':''); ?>>MO</option>
                    <option value="MS"<?php echo ($this->shoppingConfig['state']=='MS'?' selected="selected"':''); ?>>MS</option>
                    <option value="MT"<?php echo ($this->shoppingConfig['state']=='MT'?' selected="selected"':''); ?>>MT</option>
                    <option value="NC"<?php echo ($this->shoppingConfig['state']=='NC'?' selected="selected"':''); ?>>NC</option>
                    <option value="ND"<?php echo ($this->shoppingConfig['state']=='ND'?' selected="selected"':''); ?>>ND</option>
                    <option value="NE"<?php echo ($this->shoppingConfig['state']=='NE'?' selected="selected"':''); ?>>NE</option>
                    <option value="NH"<?php echo ($this->shoppingConfig['state']=='NH'?' selected="selected"':''); ?>>NH</option>
                    <option value="NJ"<?php echo ($this->shoppingConfig['state']=='NJ'?' selected="selected"':''); ?>>NJ</option>
                    <option value="NM"<?php echo ($this->shoppingConfig['state']=='NM'?' selected="selected"':''); ?>>NM</option>
                    <option value="NV"<?php echo ($this->shoppingConfig['state']=='NV'?' selected="selected"':''); ?>>NV</option>
                    <option value="NY"<?php echo ($this->shoppingConfig['state']=='NY'?' selected="selected"':''); ?>>NY</option>
                    <option value="OH"<?php echo ($this->shoppingConfig['state']=='OH'?' selected="selected"':''); ?>>OH</option>
                    <option value="OK"<?php echo ($this->shoppingConfig['state']=='OK'?' selected="selected"':''); ?>>OK</option>
                    <option value="OR"<?php echo ($this->shoppingConfig['state']=='OR'?' selected="selected"':''); ?>>OR</option>
                    <option value="PA"<?php echo ($this->shoppingConfig['state']=='PA'?' selected="selected"':''); ?>>PA</option>
                    <option value="RI"<?php echo ($this->shoppingConfig['state']=='RI'?' selected="selected"':''); ?>>RI</option>
                    <option value="SC"<?php echo ($this->shoppingConfig['state']=='SC'?' selected="selected"':''); ?>>SC</option>
                    <option value="SD"<?php echo ($this->shoppingConfig['state']=='SD'?' selected="selected"':''); ?>>SD</option>
                    <option value="TN"<?php echo ($this->shoppingConfig['state']=='TN'?' selected="selected"':''); ?>>TN</option>
                    <option value="TX"<?php echo ($this->shoppingConfig['state']=='TX'?' selected="selected"':''); ?>>TX</option>
                    <option value="UT"<?php echo ($this->shoppingConfig['state']=='UT'?' selected="selected"':''); ?>>UT</option>
                    <option value="VA"<?php echo ($this->shoppingConfig['state']=='VA'?' selected="selected"':''); ?>>VA</option>
                    <option value="VT"<?php echo ($this->shoppingConfig['state']=='VT'?' selected="selected"':''); ?>>VT</option>
                    <option value="WA"<?php echo ($this->shoppingConfig['state']=='WA'?' selected="selected"':''); ?>>WA</option>
                    <option value="WI"<?php echo ($this->shoppingConfig['state']=='WI'?' selected="selected"':''); ?>>WI</option>
                    <option value="WV"<?php echo ($this->shoppingConfig['state']=='WV'?' selected="selected"':''); ?>>WV</option>
                    <option value="WY"<?php echo ($this->shoppingConfig['state']=='WY'?' selected="selected"':''); ?>>WY</option>
                    <option value="AA"<?php echo ($this->shoppingConfig['state']=='AA'?' selected="selected"':''); ?>>AA</option>
                    <option value="AE"<?php echo ($this->shoppingConfig['state']=='AE'?' selected="selected"':''); ?>>AE</option>
                    <option value="AP"<?php echo ($this->shoppingConfig['state']=='AP'?' selected="selected"':''); ?>>AP</option>
                    <option value="AS"<?php echo ($this->shoppingConfig['state']=='AS'?' selected="selected"':''); ?>>AS</option>
                    <option value="FM"<?php echo ($this->shoppingConfig['state']=='FM'?' selected="selected"':''); ?>>FM</option>
                    <option value="GU"<?php echo ($this->shoppingConfig['state']=='GU'?' selected="selected"':''); ?>>GU</option>
                    <option value="MH"<?php echo ($this->shoppingConfig['state']=='MH'?' selected="selected"':''); ?>>MH</option>
                    <option value="MP"<?php echo ($this->shoppingConfig['state']=='MP'?' selected="selected"':''); ?>>MP</option>
                    <option value="PR"<?php echo ($this->shoppingConfig['state']=='PR'?' selected="selected"':''); ?>>PR</option>
                    <option value="PW"<?php echo ($this->shoppingConfig['state']=='PW'?' selected="selected"':''); ?>>PW</option>
                    <option value="VI"<?php echo ($this->shoppingConfig['state']=='VI'?' selected="selected"':''); ?>>VI</option>
                </select>

                
             </div>
        <div style="overflow:hidden;margin-top:2px;padding:2px;">
		<label style="margin:0px 5px 0px 5px;">{%Zip%}:</label>
                <input type="text" value="<?php echo $this->shoppingConfig['zip']; ?>" name="zip" id="zip" style="height:23px;width:90px;padding:2px 3px;"/>

            <label style="margin:0px 5px 0px 10px;">{%Country:%}</label>
			<?php echo $this->formSelect('country', $this->shoppingConfig['country'], array('style'=>'width:150px;'), RCMS_Object_QuickConfig_QuickConfig::$worldCountries); ?>
        </div>  
        </fieldset>

        
    </div>

    <div class="block2">
        <fieldset><legend>{%Return &amp; Shipping Policy%}</legend>
			<div class="fformated-main">
				<div class="field">
					<label>{%Select Policy Page%}:</label>
					<select name="policy-page-name" style="width: 60%">
						<?php foreach ($this->pageList as $page) : ?>
							<option value="<?php echo $page['url'];?>" <?php echo $this->websiteUrl.$page['url'].'.html' == $this->shoppingConfig['policy_page_url'] ? 'selected="true"':'';?>><?php echo $page['h1'];?></option>
						<?php endforeach; ?>
					</select>
				</div>
				<div class="field">
					<label>{%Legal Info%}:</label><br/>
					<?php echo $this->formTextarea('legal-info', $this->shoppingConfig['legal-info'], array('cols'=>'50','rows'=>'2', 'style'=>'width:100%;')); ?>
				</div>
			</div>
        </fieldset>
        <fieldset><legend>{%Payment%}</legend>
            <div style="float:left; width: 48%; margin: 0px 1%;">
                <p><label>{%Currency%}: </label>
                    <select name="currency" id="currency" style="width: 80px;">
                    <option value="USD"<?php echo ($this->shoppingConfig['currency']=='USD'?' selected="selected"':''); ?>>USD</option>
                    <option value="AUD"<?php echo ($this->shoppingConfig['currency']=='AUD'?' selected="selected"':''); ?>>AUD</option>
                    <option value="BRL"<?php echo ($this->shoppingConfig['currency']=='BRL'?' selected="selected"':''); ?>>BRL</option>
                    <option value="GBP"<?php echo ($this->shoppingConfig['currency']=='GBP'?' selected="selected"':''); ?>>GBP</option>
                    <option value="CAD"<?php echo ($this->shoppingConfig['currency']=='CAD'?' selected="selected"':''); ?>>CAD</option>
                    <option value="CZK"<?php echo ($this->shoppingConfig['currency']=='CZK'?' selected="selected"':''); ?>>CZK</option>
                    <option value="DKK"<?php echo ($this->shoppingConfig['currency']=='DKK'?' selected="selected"':''); ?>>DKK</option>
                    <option value="EUR"<?php echo ($this->shoppingConfig['currency']=='EUR'?' selected="selected"':''); ?>>EUR</option>
                    <option value="HKD"<?php echo ($this->shoppingConfig['currency']=='HKD'?' selected="selected"':''); ?>>HKD</option>
                    <option value="HUF"<?php echo ($this->shoppingConfig['currency']=='HUF'?' selected="selected"':''); ?>>HUF</option>
                    <option value="ILS"<?php echo ($this->shoppingConfig['currency']=='ILS'?' selected="selected"':''); ?>>ILS</option>
                    <option value="JPY"<?php echo ($this->shoppingConfig['currency']=='JPY'?' selected="selected"':''); ?>>JPY</option>
                    <option value="MXN"<?php echo ($this->shoppingConfig['currency']=='MXN'?' selected="selected"':''); ?>>MXN</option>
                    <option value="NZD"<?php echo ($this->shoppingConfig['currency']=='NZD'?' selected="selected"':''); ?>>NZD</option>
                    <option value="NOK"<?php echo ($this->shoppingConfig['currency']=='NOK'?' selected="selected"':''); ?>>NOK</option>
                    <option value="PHP"<?php echo ($this->shoppingConfig['currency']=='PHP'?' selected="selected"':''); ?>>PHP</option>
                    <option value="PLN"<?php echo ($this->shoppingConfig['currency']=='PLN'?' selected="selected"':''); ?>>PLN</option>
                    <option value="SGD"<?php echo ($this->shoppingConfig['currency']=='SGD'?' selected="selected"':''); ?>>SGD</option>
                    <option value="SEK"<?php echo ($this->shoppingConfig['currency']=='SEK'?' selected="selected"':''); ?>>SEK</option>
                    <option value="CHF"<?php echo ($this->shoppingConfig['currency']=='CHF'?' selected="selected"':''); ?>>CHF</option>
                    <option value="TWD"<?php echo ($this->shoppingConfig['currency']=='TWD'?' selected="selected"':''); ?>>TWD</option>
                    <option value="THB"<?php echo ($this->shoppingConfig['currency']=='THB'?' selected="selected"':''); ?>>THB</option>
                    </select>
                </p>
                <p><label>{%Gateway%}: </label>
                    <select name="gateway" id="gateway" style="width: 80px" onchange="if(this.options[this.selectedIndex].value == ''){this.form.quote.checked=true;document.getElementById('settingsforpaypal').style.display='none';}else{this.form.quote.checked=false;document.getElementById('settingsforpaypal').style.display='block';}">
                    <option value=""<?php echo ($this->shoppingConfig['gateway']==''?' selected="selected"':''); ?>>select</option>
                    <option value="paypal"<?php echo ($this->shoppingConfig['gateway']=='paypal'?' selected="selected"':''); ?>>PayPal</option>
                    </select>
                </p>

				<p><label>{%Use HTTPS%}</label>
					<span style="margin-left: 20px;">
						<?php if($this->shoppingConfig['use_https'] == '1'): ?>
						<input style="vertical-align: bottom;" type="radio" name="use-https" value="1" checked /><span style="font-size: 1.1em; font-weight: bold;">Yes</span>
						<input style="margin-left: 10px; vertical-align: bottom;" type="radio" name="use-https" value="0" /><span style="font-size: 1.1em; font-weight: bold;">No</span>
						<?php elseif($this->shoppingConfig['use_https'] == '0'): ?>
						<input style="vertical-align: bottom;" type="radio" name="use-https" value="1" /><span style="font-size: 1.1em; font-weight: bold;">Yes</span>
						<input style="margin-left: 10px; vertical-align: bottom;" type="radio" name="use-https" value="0" checked /><span style="font-size: 1.1em; font-weight: bold;">No</span>
						<?php else: ?>
						<input style="vertical-align: bottom;" type="radio" name="use-https" value="1" /><span style="font-size: 1.1em; font-weight: bold;">Yes</span>
						<input style="margin-left: 10px; vertical-align: bottom;" type="radio" name="use-https" value="0" checked /><span style="font-size: 1.1em; font-weight: bold;">No</span>
						<?php endif; ?>
					</span>
				</p>
            </div>

            <div style="float:left; width: 48%; margin: 0px 1%;">
                <p id="quote-hint" style="float:left;width: 85%;text-align: justify">{%Check this box if you want to offer your clients the option of asking for a%}
                <label>{%Quote%}:</label><p>
                    <input type="checkbox" name="quote" id="quote" style="float:right; margin:15px 5px 0px 0px;" onmouseover="$('#quote-hint').css('color','red');" onmouseout="$('#quote-hint').css('color','#7C7C7C');" <?php echo ($this->shoppingConfig['quote']=='1'?'checked="checked"':''); ?> />
                <p id="gen-quote-auto" style="float: left; width: 100%;">{%Generate quote automatically %}
                    <input type="checkbox" name="autoquote" id="autoquote" style="float:right; margin:0px 5px;" <?php echo ($this->shoppingConfig['autoquote']=='1'?'checked="checked"':''); ?> />
                </p>
            </div>
			<div style="float: left; width: 99%; margin-top: 5px">
				<div style="float: left; width: 80%; text-align: justify">
					<label>{%Limit international clientele to quote request%}.</label>
				</div>
				<div style="float: right; width: 20%; text-align: center">
					<input type="checkbox" name="deny-int-payment" id="deny-int-payment" <?php echo ($this->shoppingConfig['deny-int-payment']=='1'?'checked="checked"':''); ?> />
				</div>
				<div style="float: left; clear: both">
					{%No credit cart option is provided at checkout%}.
				</div>
			</div>
        </fieldset>
          <div id="settingsforpaypal" <?php echo $this->shoppingConfig['gateway']=='paypal'?'style="display:block;"':''; ?>>
            <fieldset><legend>{%Paypal Settings%}</legend>
            <?php $settingsPayPal = unserialize($this->shoppingConfig['paypal']); ?>
            <p><label>{%Email%}:</label> <input type="text" name="paypalemail" id="paypalemail" value="<?php echo $settingsPayPal['email']; ?>" /></p>
            <p><label>{%API Signature%}:</label> <input type="text" name="paypalsignature" id="paypalsignature" value="<?php echo $settingsPayPal['signature']; ?>"/></p>
            <p><label>{%API User%}:</label> <input type="text" name="paypaluser" id="paypaluser" value="<?php echo $settingsPayPal['user']; ?>" /></p>
            <p><label>{%API Password%}:</label> <input type="text" name="paypalpassword" id="paypalpassword" value="<?php echo $settingsPayPal['password']; ?>" /></p>
   		  </fieldset>
	      </div>
        		
    </div><!--  end block2 div -->
    <div style="bottom:0;margin:5px 15px;position:absolute;"><!-- Begin PayPal Logo -->
        <a href="https://www.paypal.com/us/mrb/pal=4E7GQK85JKSBA" target="_blank">
            <img width="468" height="60" src="http://images.paypal.com/en_US/i/bnr/paypal_mrb_banner.gif" border="0" alt="Sign up for PayPal and start accepting credit card payments instantly." />
        </a>
    </div><!-- End PayPal Logo -->
   	<input type="submit" name="submit" value="{%Save%}" class="formsubmit"/>

</form>

</div>